﻿{% extends "base.html" %}

{%block title%}Pregled/brisanje prijave{% endblock %}
{% block js %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/search.js"></script>
<script type="text/javascript">

$(document).ready(function(){    
    search_setcb('student', function(student){
      url = '/exams/delete_applications/'+student.pk+'/';
      document.location = url;
    });
});
</script>
{% endblock %}

{% block content %}
{% if only_search %}
{% include "snippets/student/search.htm" %}
{% else %}
	{% if not user.student %}
<p class="options_panel">
  <button onclick="search_show('student')">Poišči drugega študenta</button>
</p>
{% endif %}

{% if referent %}


{% endif %}

{% if empty_list %}
	{% if referent %}
	<center>Študent trenutno ni prijavljen na noben izpit.</center>
	<br/>
	{% else %}
	<center>Trenutno niste prijavljeni na noben izpit.</center>
	<br/>
	{% endif %}
{% else %}
	<form method = 'post'>
	{% csrf_token %}
	
	<table class = "list">
		<th> Možnost odjave </th>
		<th> Predmet </th>
		<th> Predavatelj </th>
		<th> Datum </th>
		<th> Ura </th>
		<th> Predavalnica </th>
		<th> Št. prijavljenih </th>
		
		{% for i in list %}
		<tr> 
			{% for j in i %}
				{% if forloop.counter == 1 %}
					{% if j != -1 %}
					<td>
					{% if step_next == 1 %}
						<input type="submit" name= {{ j }} value="Odjavi" />
					{% else %}
						<input type="submit" name= {{ j }} value="Potrdi odjavo" />
					{% endif %}	
					</td>
					{% else %}	
					<td> Odjava ni mogoča! </td>
					{% endif %}
					
				{% else %}
					<td>{{ j }}</td>
				{% endif %}
				
			{% endfor %}
			
		</tr>
		
		{% endfor %}
	</table>
	
	<input name="step" type="hidden" value="{{step_next}}" />
	</form>

{% endif %}

{% if warning %}
	<center><b>Opozorilo:</b> Rok za odjavo je potekel!</center>
	<br/>
{% endif %}
	
{% if deleted %}
	<center>Prijava na izpit uspešno izbrisana!</center>
	<br/>
{% endif %}	
{% endif %}
{% endblock %}>
